<?php

/**
 * TbsCliente filter form base class.
 *
 * @package    AltargetEcommerce
 * @subpackage filter
 * @author     Carlo Lopez
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseTbsClienteFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'cli_nombre'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'cli_rif'           => new sfWidgetFormFilterInput(),
      'cli_codpais'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('fk_cli_codpais'), 'add_empty' => true)),
      'cli_codsec'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('fk_cli_codsec'), 'add_empty' => true)),
      'cli_email_address' => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'cli_fecha_corte'   => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'cli_correorebo'    => new sfWidgetFormFilterInput(),
      'cli_franquicia'    => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'cli_status'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'cli_nit'           => new sfWidgetFormFilterInput(),
      'cli_pw'            => new sfWidgetFormFilterInput(),
      'cli_codseal'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('fk_cli_codseal'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'cli_nombre'        => new sfValidatorPass(array('required' => false)),
      'cli_rif'           => new sfValidatorPass(array('required' => false)),
      'cli_codpais'       => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('fk_cli_codpais'), 'column' => 'pai_codigo')),
      'cli_codsec'        => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('fk_cli_codsec'), 'column' => 'sec_codigo')),
      'cli_email_address' => new sfValidatorPass(array('required' => false)),
      'cli_fecha_corte'   => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'cli_correorebo'    => new sfValidatorPass(array('required' => false)),
      'cli_franquicia'    => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'cli_status'        => new sfValidatorPass(array('required' => false)),
      'cli_nit'           => new sfValidatorPass(array('required' => false)),
      'cli_pw'            => new sfValidatorPass(array('required' => false)),
      'cli_codseal'       => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('fk_cli_codseal'), 'column' => 'seal_codigo')),
    ));

    $this->widgetSchema->setNameFormat('tbs_cliente_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'TbsCliente';
  }

  public function getFields()
  {
    return array(
      'cli_codigo'        => 'Number',
      'cli_nombre'        => 'Text',
      'cli_rif'           => 'Text',
      'cli_codpais'       => 'ForeignKey',
      'cli_codsec'        => 'ForeignKey',
      'cli_email_address' => 'Text',
      'cli_fecha_corte'   => 'Date',
      'cli_correorebo'    => 'Text',
      'cli_franquicia'    => 'Boolean',
      'cli_status'        => 'Text',
      'cli_nit'           => 'Text',
      'cli_pw'            => 'Text',
      'cli_codseal'       => 'ForeignKey',
    );
  }
}
